data<-read.table("GE.txt",sep="\t",head=T)
write.table(data2,"GE.txt",sep="\t",row.names=T,quote=FALSE)
write.table(data,"GE.txt",sep="\t",row.names=T,quote=FALSE)
getwd()
write.table(data,"GE.txt",sep="\t",col.names=T,quote=FALSE)
write.table(data,"GE.txt",sep="\t",col.names=T,row.names=F,quote=FALSE)
snp<-read.table("SNP_maf10_all_germline_sample.txt",sep="\t",head=T)
snp<-read.table("/data1/bsi/BORA_processing/devel/eqtl/OV_EQTL/OV_GNT/SNP_maf10_all_germline_sample.txt",sep="\t",head=T)
colnames_snp<-colnames(snp)
colnames_snp[1]
colnames_snp[2]
colnames_snp<-gsub(".","-",colnames_snp)
colnames_snp[2]
colnames_snp[1]
colnames_snp<-colnames(snp)
colnames_snp[1]
colnames_snp<-gsub('.',"-",colnames_snp)
colnames_snp[1]
colnames_snp<-colnames(snp)
colnames_snp<-gsub('\.',"-",colnames_snp)
colnames_snp<-gsub("\\.","-",colnames_snp)
colnames_snp[1]
colnames_snp[2]
unlist(strsplit("a.b.c", "-"))
unlist(strsplit(colnames_snp[1], "-"))
unlist(strsplit(colnames_snp[2], "-"))
unlist(strsplit(colnames_snp[2], "-"))[1:3]
unlist(strsplit(colnames_snp, "-"))[1:3]
strsplit(colnames_snp, "-")
strsplit(colnames_snp, "-")[1:3]
strsplit(colnames_snp[2], "-")[1:3]
unlist(strsplit(colnames_snp, "-"))[1:3]
paste(unlist(strsplit(colnames_snp, "-"))[1:3],collage='-')
paste(unlist(strsplit(colnames_snp[2], "-"))[1:3],collage='-')
paste(unlist(strsplit(colnames_snp[2], "-"))[1:3],collade='-')
paste(unlist(strsplit(colnames_snp[2], "-"))[1:3],collapse='-')
paste(unlist(strsplit(colnames_snp[1], "-"))[1:3],collapse='-')
ls()
dim(snp)
colnames(snp)[1:3]
colnames_snp[1:3]
length(colnames_snp)
i<-2
while(i<length(colnames_snp))
{
colnames_snp[i]<-paste(unlist(strsplit(colnames_snp[i], "-"))[1:3],collapse='-')
i<-i+1
}
dim(colnames_snp)
length(colnames_snp)
colnames_snp[1:5]
table(colnames_snp)
length(colnames_snp)
unique(colnames_snp)
i<-2
i<-408
colnames_snp[i]<-paste(unlist(strsplit(colnames_snp[i], "-"))[1:3],collapse='-')
colnames_snp[408]
length(unique(colnames_snp))
ls
ls()
data[1,1:4]
dim(snp)
colnames(snp)<-colnames_snp
colnames_gene<-colnames(data)
data[1:5]
colnames_gene[1:5]
colnames_gene<-gsub(".","-",colnames_gene)
colnames_gene[1:5]
colnames_gene<-colnames(data)
colnames_gene<-gsub("\\.","-",colnames_gene)
colnames_gene[1:5]
i<-2
while(i<length(colnames_gene))
{ colnames_gene[i]<-paste(unlist(strsplit(colnames_gene[i], "-"))[1:3],collapse='-')
while(i<length(colnames_gene)+1)
{ colnames_gene[i]<-paste(unlist(strsplit(colnames_gene[i], "-"))[1:3],collapse='-')
i<-i+1
}
colnames_gene[1:4]
length(unique(colnames_gene))
unique(colnames_gene)
length(unique(colnames_gene))
length((colnames_gene))
ls()
dim(data)
table(colnames_gene)
table(colnames_gene)[2]
table(colnames_gene)[3]
table(colnames_gene)[4]
table(colnames_gene)[14]
table(colnames_gene)[1,1]
g<-c(1,1,1,2,3)
duplicated(g)
which(duplicated(g))
which(!duplicated(g))
ls()
data[1,1:5]
colnames_gene[1:5]
dim(data)
data<-data[,which(!duplicated(colnames_gene))]
dim(data)
colnames_gene<-colnames_gene[,which(!duplicated(colnames_gene))]
which(!duplicated(colnames_gene))
length(which(!duplicated(colnames_gene)))
colnames_gene<-colnames_gene[which(!duplicated(colnames_gene))]
colnames(data)<- colnames_gene
ls()
colnames_snp[1:5]
colnames_gene[1:5]
intersect
colnames<-intersect(colnames_gene,colnames_snp)
length(colnames)
colnames[1;5]
colnames[1:5]
ls()
data <-data[,c("geneid",colnames)]
dim(data)
snp <-snp[,c("rsid",colnames)]
dim(snp)
write.table(snp,"SNP.txt",sep="\t",col.names=TRUE,row.names=FALSE,quote=F)
write.table(data,"GE.txt",sep="\t",col.names=TRUE,row.names=FALSE,quote=F)
snp[1:5,1]
loc<-read.table("snpsloc.txt",sep="\t",head=T)
colnames(snp)[1:5]
dim(snp)
dim(loc)
colnames(loc)
snp[,1]<-loc[,1]
colnames(snp)[1:5]
write.table(snp,"SNP.txt",sep="\t",col.names=TRUE,row.names=FALSE,quote=F)
savehistory("processing_select_common_samp_expr_gnt.R")
